package com.sa35.fbs.model;

import java.util.HashMap;
import java.util.Map;

public enum UserRoleEnum {
	ADMIN(1,"Admin"),
	MANAGER(2,"Manager"), 
	STAFF(3,"Staff");
	private Integer value;
	private String display;
	
	private UserRoleEnum(Integer value, String display){
		this.value = value;
		this.display = display;
	}
	
	private static Map<Integer,UserRoleEnum> valueMap = new HashMap<Integer,UserRoleEnum>();
	static{
		for(UserRoleEnum b : values()){
			valueMap.put(b.value,b);
		}
	}
	
	@Override
	public String toString(){
		return display;
	}
	
	public Integer getValue(){
		return value;
	}
	
	public static UserRoleEnum lookup(Integer key) throws IllegalArgumentException {
        if(key==null)
            return null;
        else if(!valueMap.containsKey(key))
            throw new IllegalArgumentException("Can not find enum member: " + key);
        return valueMap.get(key);
    }

}
